Bubble Sort is a simple comparison-based sorting algorithm. It works by repeatedly stepping through the list, comparing adjacent elements and swapping them if they are in the wrong order. The pass through the list is repeated until no more swaps are needed, which means the list is sorted.
Time Complexity: O(n²) in worst and average cases: